Skip to content

[Serializer] Clarifies 'csv_headers' option #14609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

lajosthiel
Copy link
Contributor

No description provided.

@@ -897,7 +897,7 @@ Option Description De
``csv_escape_char`` Sets the escape character (at most one character)
``csv_key_separator`` Sets the separator for array's keys during its ``.``
flattening
``csv_headers`` Sets the headers for the data ``[]``, inferred from input data's keys
``csv_headers`` Sets the order of the header and data columns ``[]``, inferred from input data's keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand the problem you want to fix ... but I'm not sure the fix is correct.

If I read "sets the headers for the data", I think about this:

'csv_headers' => ['Header 1 Name', 'Header 2 Name', '...']

But if I read "sets the order of the header and data", I understand it like this:

# header name => header position
'csv_headers' => ['Header 1 Name' => 2, 'Header 2 Name' => 1, '...']

Maybe adding a small example could help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comments. I added an example, hopefully that will make it more clear.

@carsonbot carsonbot changed the title Clarifies 'csv_headers' option [Serializer] Clarifies 'csv_headers' option Nov 27, 2020
@OskarStark OskarStark added the Waiting Code Merge Docs for features pending to be merged label Dec 7, 2020
@OskarStark OskarStark modified the milestones: 5.2, next Jan 7, 2021
@OskarStark OskarStark removed the Waiting Code Merge Docs for features pending to be merged label Jan 7, 2021
@OskarStark OskarStark modified the milestones: next, 5.2 Jan 7, 2021
@javiereguiluz
Copy link
Member

Thank you @lajosthiel and congrats on your first Symfony Docs contribution!

@javiereguiluz javiereguiluz merged commit 6d74c1a into symfony:4.4 Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants